﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using F_MODEL;
using System.Data.SqlClient;
using System.Data;

namespace F_DAL
{
    public class CouponsDal
    {
        /// <summary>
        /// 优惠券数据信息显示
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public List<Coupons> CouponsSel(int id)
        {
            SqlParameter[] paramter ={
                               new  SqlParameter("@Userid",SqlDbType.Int){Value=id}
                               };
            SqlDataReader read = DbHelperSQL.RunProcedure("dbo.Coupons_All", paramter);
            List<Coupons> list = new List<Coupons>();
            while (read.Read())
            { 
                Coupons us = new Coupons();
                us.couponsId = Convert.ToInt32( read["couponsId"].ToString());
                us.couponsEndTime=read["couponsEndTime"].ToString();
                us.couponsValue = Convert.ToInt32(read["couponsValue"].ToString());;
                list.Add(us);
            }
            return list;
        }
    }
}
